
var JSPlugin = function() { 

}

JSPlugin.prototype.list = function(directory,successCallback, failureCallback) {

    return PhoneGap.exec(successCallback,    //Callback which will be called when directory listing is successful
    					failureCallback,     //Callback which will be called when directory listing encounters an error
    					'PhoneGapPlugin',  //Telling PhoneGap that we want to run "DirectoryListing" Plugin
    					'list',              //Telling the plugin, which action we want to perform
    					[directory]);        //Passing a list of arguments to the plugin, in this case this is the directory path
};

JSPlugin.prototype.startActivity = function(directory,successCallback, failureCallback) {

    return PhoneGap.exec(successCallback,   
    					failureCallback,    
    					'PhoneGapPlugin',  
    					'startactivity',   
    					[directory]);      
};

PhoneGap.addConstructor(function() {
	//Register the javascript plugin with PhoneGap
	console.log("add plugin directoryListing...");
	PhoneGap.addPlugin('directorylisting', new JSPlugin());
	console.log("add plugin directoryListing successfully");
	
	//Register the native class of plugin with PhoneGap
	PluginManager.addService("PhoneGapPlugin","com.phonegap.plugin.PhoneGapPlugin");
});